#! /usr/bin/env python
# -*- coding:utf-8 -*-
# Author Jmz

# 封装
class student(object):
    def __init__(self,name,age):
        self.__name = name   # 封装的属性
        self.__age = age

    def __name_age(self):  # 封装方法
        return "name: %s; age: %s"%(self.__name,self.__age)

    def get_name_age(self):
        return self.__name_age()

jmz = student('jmz',13)
# print(jmz.__name)   #会报错AttributeError: 'student' object has no attribute '__name'
print(jmz.get_name_age())


'''
输出结果
name: jmz; age: 13
'''

print(jmz.__dict__)
'''
输出结果
{'_student__name': 'jmz', '_student__age': 13}
'''


print(jmz._student__name)
'''
输出结果
jmz
'''

